package com.learn.english.mapper;

import com.learn.english.model.entity.ChatSession;
import com.learn.english.model.param.Messages;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author TISNIW
 * @version 1.0
 * @date 2024/9/16 16:10
 * @desc
 */
@Mapper
public interface ChatSessionMapper {
    @Select("select title from chat_session where id = #{sessionId}")
    String getSession(String sessionId);
    // ChatSessionMapper.java
    @Insert("insert into chat_session (id,user_id, title) values (#{sessionId},#{userId}, #{title})")
    Integer createSession(String sessionId,Long userId, String title);
    @Select("select * from chat_session where user_id = #{userId}")
    List<ChatSession> listSessionsByUserId(Long userId);
    @Delete("delete from chat_session where id = #{sessionId}")
    Integer deleteSessionById(String sessionId);
    @Select("select * from chat_session where id = #{sessionId}")
    ChatSession getSessionById(String sessionId);
    @Update("update chat_session set title = #{title} where id = #{sessionId}")
    Integer updateSession(String sessionId, String title);

}
